import threading

# 定义一个线程要执行的任务
def worker(num):
    while True:
        # 这里只是一个示例，防止无限循环，实际上应该包含有意义的工作逻辑
        if num % 10 == 0:
            break
        print(f"Thread {num} working...")

# 创建10个线程实例
threads = []
for i in range(10):
    thread = threading.Thread(target=worker, args=(i,))
    threads.append(thread)
    # 启动线程
    thread.start()

# 等待所有线程完成
for thread in threads:
    thread.join()